// 统一请求路径前缀在libs/axios.js中修改
import { getRequest, postRequest, postBodyRequest, getNoAuthRequest } from '@/libs/axios';
//校区管理
export const getAllCampusAPI = params => {
    return postRequest('/campus/getByCampusName', params);
};
//添加校区
export const addCampusAPI = params => {
    return postRequest('/campus/addCampus', params);
};
//学校信息
export const getAllSchoolInfoAPI = () => {
    return postRequest('/campus/getAllSchoolInfo');
};
//更新学校信息
export const updateAllSchoolInfoAPI = params => {
    return postRequest('/campus/updateSchoolInfo', params);
};
//院校信息
export const getParentCollageAPI = () => {
    return postRequest('/campus/getParentCollage');
};
//学校信息
export const getCurrentSchoolInfoAPI = () => {
    return postRequest('/yxManage/getCurrentSchoolInfo');
};
//院系
export const getListByCodeAPI = params => {
    return postRequest('/yxManage/getListByCode', params);
};
//根据院系id获取院系信息
export const getCollageInfoByIdAPI = params => {
    return postRequest('/yxManage/getCollageInfoById', params);
};
//场地管理
export const getSiteManagementAPI = params => {
    return postRequest('/school/shVenue/pageByName', params);
};
//添加场地
export const addSiteAPI = params => {
    return postRequest('/school/shVenue/add', params);
};
export const getCampusList = params => {
    return postRequest('/school/shVenue/getCampus', params);
};
//院系信息修改
export const updateCollegeAPI = params => {
    return postRequest('/yxManage/updateCollegeIntro', params);
};
//删除一条校区信息
export const deleteCampusAPI = params => {
    return postRequest('/campus/deleteCampus', params);
};
//修改一条校区信息
export const updateCampusAPI = params => {
    return postRequest('/campus/updateCampus', params);
};
//删除一条场地信息
export const deletePlaceAPI = params => {
    return postRequest('/school/shVenue/delById', params);
};
//修改一条场地信息
export const updatePlaceAPI = params => {
    return postRequest('/school/shVenue/update', params);
};

// region TODO 导出数据
export const exportDataAPI = async campusManageIds => {
    let body = campusManageIds ? 'campusManageIds=' + campusManageIds.join(',') : '';

    let baseApi = config.baseApi;
    let accessToken = sessionStorage.getItem('accessToken');
    let res = await fetch(baseApi + '/campus/import', {
        method: 'post',
        headers: {
            accessToken: accessToken,
            'Content-Type': 'application/x-www-form-urlencoded'
        },
        body
    });
    return res.blob();
};

// endregion
